using CodePlex.DnD4eCampaignManager.DnD4e.Enums;
using CodePlex.DnD4eCampaignManager.DnD4e.Interfaces;
using CodePlex.DnD4eCampaignManager.Presentation.ViewInterfaces;
using NUnit.Framework;
using Rhino.Mocks;

namespace CodePlex.DnD4eCampaignManager.CampaignManagerTests.PresentationTests
{
    public class PlayerCharacterPresenterTestHelpers
    {
        public const string PLAYER_CHARACTER_NAME = "Super Killer Sword Guy";
        private const int AGE = 52;
        private const Alignment ALIGNMENT = Alignment.Unaligned;
        private const int ARMOR_CLASS_DEFENSE = 26;
        private const string AT_WILL_POWERS = "Punching";
        private const int CHARISMA_SCORE = 15;
        private const string CLASS_NAME = "Fighter";
        private const string CONDITIONS = "Dry skin";
        private const int CONSTITUTION_SCORE = 19;
        private const int CURRENT_HIT_POINTS = 13;
        private const string DAILY_POWERS = "Head butt";
        private const string DEITY = "Bahamut";
        private const int DEXTERITY_SCORE = 18;
        private const string ENCOUNTER_POWERS = "Kicking";
        private const string EPIC_DESTINY = "Demigod";
        private const int EXPERIENCE_POINTS = 5000;
        private const string FEATS = "Of strength";
        private const int FORTITUDE_DEFENSE = 26;
        private const Gender GENDER = Gender.Male;
        private const string HEIGHT = "4'10\"";
        private const int HIT_POINTS = 50;
        private const int INITIATIVE_MODIFIER = 1;
        private const int INTELLIGENCE_SCORE = 17;
        private const string PARAGON_PATH = "Iron Vanguard";
        private const CreatureSize PLAYER_CHARACTER_SIZE = CreatureSize.Medium;
        private const string RACE_NAME = "Dwarf";
        private const int REFLEX_DEFENSE = 21;
        private const string RITUALS = "Bathing";
        private const string SPECIAL_FEATURES = "Can jump really high";
        private const int SPEED = 7;
        private const string SPEED_MISC = "Swim 5";
        private const int STRENGTH_SCORE = 20;
        private const int WEIGHT = 240;
        private const int WILLPOWER_DEFENSE = 29;
        private const int WISDOM_SCORE = 16;

        public PlayerCharacterPresenterTestHelpers(IPlayerCharacterView playerCharacterView)
        {
            PlayerCharacterView = playerCharacterView;
        }

        public IPlayerCharacterView PlayerCharacterView { get; set; }

        public void PullAbilitiesFromView(MockRepository mocks)
        {
            Expect.Call(PlayerCharacterView.AbilityStrength).Return(STRENGTH_SCORE);
            Expect.Call(PlayerCharacterView.AbilityConstitution).Return(CONSTITUTION_SCORE);
            Expect.Call(PlayerCharacterView.AbilityDexterity).Return(DEXTERITY_SCORE);
            Expect.Call(PlayerCharacterView.AbilityIntelligence).Return(INTELLIGENCE_SCORE);
            Expect.Call(PlayerCharacterView.AbilityWisdom).Return(WISDOM_SCORE);
            Expect.Call(PlayerCharacterView.AbilityCharisma).Return(CHARISMA_SCORE);
        }

        public void PullBasicDataFromView(MockRepository mocks)
        {
            Expect.Call(PlayerCharacterView.CharacterClass).Return(CLASS_NAME);
            Expect.Call(PlayerCharacterView.CharacterParagonPath).Return(PARAGON_PATH);
            Expect.Call(PlayerCharacterView.CharacterEpicDestiny).Return(EPIC_DESTINY);
            Expect.Call(PlayerCharacterView.CharacterExperiencePoints).Return(EXPERIENCE_POINTS);
            Expect.Call(PlayerCharacterView.CharacterRace).Return(RACE_NAME);
            Expect.Call(PlayerCharacterView.CreatureSize).Return(PLAYER_CHARACTER_SIZE);
            Expect.Call(PlayerCharacterView.CharacterAge).Return(AGE);
            Expect.Call(PlayerCharacterView.CharacterGender).Return(GENDER);
            Expect.Call(PlayerCharacterView.CharacterHeight).Return(HEIGHT);
            Expect.Call(PlayerCharacterView.CharacterWeight).Return(WEIGHT);
            Expect.Call(PlayerCharacterView.CharacterAlignment).Return(ALIGNMENT);
            Expect.Call(PlayerCharacterView.CharacterDeity).Return(DEITY);
        }

        public void PullDefensesFromView(MockRepository mocks)
        {
            Expect.Call(PlayerCharacterView.DefenseArmorClass).Return(ARMOR_CLASS_DEFENSE);
            Expect.Call(PlayerCharacterView.DefenseFortitude).Return(FORTITUDE_DEFENSE);
            Expect.Call(PlayerCharacterView.DefenseReflex).Return(REFLEX_DEFENSE);
            Expect.Call(PlayerCharacterView.DefenseWillpower).Return(WILLPOWER_DEFENSE);
        }

        public void PullHitPointsFromView(MockRepository mocks)
        {
            Expect.Call(PlayerCharacterView.HitPointsMaximum).Return(HIT_POINTS);
            Expect.Call(PlayerCharacterView.HitPointsCurrent).Return(CURRENT_HIT_POINTS);
        }

        public void PullInitiativeFromView(MockRepository mocks)
        {
            Expect.Call(PlayerCharacterView.InitiativeModifier).Return(INITIATIVE_MODIFIER);
        }

        public void PullMovementFromView(MockRepository mocks)
        {
            Expect.Call(PlayerCharacterView.MovementSpeed).Return(SPEED);
            Expect.Call(PlayerCharacterView.MovementSpeedOther).Return(SPEED_MISC);
        }

        public void PullPowersFromView(MockRepository mocks)
        {
            Expect.Call(PlayerCharacterView.PowersAtWill).Return(AT_WILL_POWERS);
            Expect.Call(PlayerCharacterView.PowersEncounter).Return(ENCOUNTER_POWERS);
            Expect.Call(PlayerCharacterView.PowersDaily).Return(DAILY_POWERS);
            Expect.Call(PlayerCharacterView.CharacterRituals).Return(RITUALS);
            Expect.Call(PlayerCharacterView.SpecialQualities).Return(SPECIAL_FEATURES);
            Expect.Call(PlayerCharacterView.CharacterFeats).Return(FEATS);
            Expect.Call(PlayerCharacterView.Conditions).Return(CONDITIONS);
        }

        public void PullSensesFromView(MockRepository mocks)
        {
            Expect.Call(PlayerCharacterView.SensesOther).Return("Monkey vision");
        }

        public void PullSurgesFromView(MockRepository mocks)
        {
            Expect.Call(PlayerCharacterView.HealingSurgesCurrent).Return(12);
            Expect.Call(PlayerCharacterView.HealingSurgesMaximum).Return(5);
        }

        public void PushAbilitiesToView(IPlayerCharacter playerCharacter)
        {
            PlayerCharacterView.AbilityStrength = playerCharacter.AbilityStrength;
            PlayerCharacterView.AbilityConstitution = playerCharacter.AbilityConstitution;
            PlayerCharacterView.AbilityDexterity = playerCharacter.AbilityDexterity;
            PlayerCharacterView.AbilityIntelligence = playerCharacter.AbilityIntelligence;
            PlayerCharacterView.AbilityWisdom = playerCharacter.AbilityWisdom;
            PlayerCharacterView.AbilityCharisma = playerCharacter.AbilityCharisma;
        }

        public void PushBasicDataToView(IPlayerCharacter playerCharacter)
        {
            PlayerCharacterView.CharacterLevel = playerCharacter.CharacterLevel;
            PlayerCharacterView.CharacterClass = playerCharacter.CharacterClass;
            PlayerCharacterView.CharacterParagonPath = playerCharacter.CharacterParagonPath;
            PlayerCharacterView.CharacterEpicDestiny = playerCharacter.CharacterEpicDestiny;
            PlayerCharacterView.CharacterExperiencePoints = playerCharacter.CharacterExperiencePoints;
            PlayerCharacterView.CharacterRace = playerCharacter.CharacterRace;
            PlayerCharacterView.CreatureSize = playerCharacter.CreatureSize;
            PlayerCharacterView.CharacterAge = playerCharacter.CharacterAge;
            PlayerCharacterView.CharacterGender = playerCharacter.CharacterGender;
            PlayerCharacterView.CharacterHeight = playerCharacter.CharacterHeight;
            PlayerCharacterView.CharacterWeight = playerCharacter.CharacterWeight;
            PlayerCharacterView.CharacterAlignment = playerCharacter.CharacterAlignment;
            PlayerCharacterView.CharacterDeity = playerCharacter.CharacterDeity;
        }

        public void PushDefensesToView(IPlayerCharacter playerCharacter)
        {
            PlayerCharacterView.DefenseArmorClass = playerCharacter.DefenseArmorClass;
            PlayerCharacterView.DefenseFortitude = playerCharacter.DefenseFortitude;
            PlayerCharacterView.DefenseReflex = playerCharacter.DefenseReflex;
            PlayerCharacterView.DefenseWillpower = playerCharacter.DefenseWillpower;
        }

        public void PushHealthDataToView(IPlayerCharacter playerCharacter)
        {
            PlayerCharacterView.HitPointsCurrent = playerCharacter.HitPointsCurrent;
            PlayerCharacterView.HitPointsMaximum = playerCharacter.HitPointsMaximum;
            PlayerCharacterView.HealingSurgesMaximum = playerCharacter.HealingSurgesMaximum;
            PlayerCharacterView.HealingSurgesCurrent = playerCharacter.HealingSurgesCurrent;
            PlayerCharacterView.HealingSurgeValue = playerCharacter.HealingSurgeValue;
        }

        public void PushMovementDataToView(IPlayerCharacter playerCharacter)
        {
            PlayerCharacterView.InitiativeModifier = playerCharacter.InitiativeModifier;
            PlayerCharacterView.MovementSpeed = playerCharacter.MovementSpeed;
            PlayerCharacterView.MovementSpeedOther = playerCharacter.MovementSpeedOther;
        }

        public void PushPowersToView(IPlayerCharacter playerCharacter)
        {
            PlayerCharacterView.PowersAtWill = playerCharacter.PowersAtWill;
            PlayerCharacterView.PowersEncounter = playerCharacter.PowersEncounter;
            PlayerCharacterView.PowersDaily = playerCharacter.PowersDaily;
            PlayerCharacterView.CharacterRituals = playerCharacter.CharacterRituals;
            PlayerCharacterView.SpecialQualities = playerCharacter.SpecialQualities;
            PlayerCharacterView.CharacterFeats = playerCharacter.CharacterFeats;
            PlayerCharacterView.Conditions = playerCharacter.Conditions;
        }

        public void PushSensesToView(IPlayerCharacter playerCharacter)
        {
            PlayerCharacterView.SensesPerceptionPassive = playerCharacter.SensesPerceptionPassive;
            PlayerCharacterView.SensesPerception = playerCharacter.SensesPerception;
            PlayerCharacterView.SensesInsightPassive = playerCharacter.SensesInsightPassive;
            PlayerCharacterView.SensesInsight = playerCharacter.SensesInsight;
            PlayerCharacterView.SensesOther = playerCharacter.SensesOther;
        }

        public void PushSkillsToView(IPlayerCharacter playerCharacter)
        {
            PlayerCharacterView.SensesInsight = playerCharacter.SensesInsight;
            PlayerCharacterView.SensesPerception = playerCharacter.SensesPerception;
            PlayerCharacterView.MovementStealth = playerCharacter.MovementStealth;
        }


        public static void AbilityAssertions(IPlayerCharacter playerCharacter)
        {
            Assert.AreEqual(STRENGTH_SCORE, playerCharacter.AbilityStrength);
            Assert.AreEqual(CONSTITUTION_SCORE, playerCharacter.AbilityConstitution);
            Assert.AreEqual(DEXTERITY_SCORE, playerCharacter.AbilityDexterity);
            Assert.AreEqual(INTELLIGENCE_SCORE, playerCharacter.AbilityIntelligence);
            Assert.AreEqual(WISDOM_SCORE, playerCharacter.AbilityWisdom);
            Assert.AreEqual(CHARISMA_SCORE, playerCharacter.AbilityCharisma);
        }

        public static void BasicAssertions(IPlayerCharacter playerCharacter)
        {
            Assert.AreEqual(CLASS_NAME, playerCharacter.CharacterClass);
            Assert.AreEqual(PARAGON_PATH, playerCharacter.CharacterParagonPath);
            Assert.AreEqual(EPIC_DESTINY, playerCharacter.CharacterEpicDestiny);
            Assert.AreEqual(EXPERIENCE_POINTS, playerCharacter.CharacterExperiencePoints);
            Assert.AreEqual(RACE_NAME, playerCharacter.CharacterRace);
            Assert.AreEqual(PLAYER_CHARACTER_SIZE, playerCharacter.CreatureSize);
            Assert.AreEqual(AGE, playerCharacter.CharacterAge);
            Assert.AreEqual(GENDER, playerCharacter.CharacterGender);
            Assert.AreEqual(HEIGHT, playerCharacter.CharacterHeight);
            Assert.AreEqual(WEIGHT, playerCharacter.CharacterWeight);
            Assert.AreEqual(ALIGNMENT, playerCharacter.CharacterAlignment);
            Assert.AreEqual(DEITY, playerCharacter.CharacterDeity);
        }

        public static void DefensesAssertions(IPlayerCharacter playerCharacter)
        {
            Assert.AreEqual(ARMOR_CLASS_DEFENSE, playerCharacter.DefenseArmorClass);
            Assert.AreEqual(FORTITUDE_DEFENSE, playerCharacter.DefenseFortitude);
            Assert.AreEqual(REFLEX_DEFENSE, playerCharacter.DefenseReflex);
            Assert.AreEqual(WILLPOWER_DEFENSE, playerCharacter.DefenseWillpower);
        }
    }
}